import { http, httpFormData} from '/request.js'
var url={
  getOpenid:'/adscm/wxLogin',/**获取openid */
  getRole: '/adscm/wechat/wechatRole/selectRolesBySessionKey',/**根据SessionKey获取用户角色信息 */
  shCustomerListAll:'/adscm/wechat/shCustomerInfo/select',/**获取浆站列表 */
  userInfo: '/adscm/wechat/wechatUser/selectBySessionKey',/***根据SessionKey查询用户信息个人信息*/
  addUpdateUserInfo:'/adscm/wechat/wechatUser/',/**浆站人员提交个人信息 insert-新增 update-修改*/
  getMachineList:"/adscm/wechat/shMachine/select",/**获取机器列表 */
  getMachineByMacCode: "/adscm/wechat/shMachine/selectByMacCode",/**根据macCode查询机器信息 */
  getMachineListAll: "/adscm/wechat/shMachine/selectLists",/**获取机器列表（无分页） */
  imageUpload:"/adscm/wechat/wechatRepairPicture/upload",/**图片上传 */
  deleteImage:"/adscm/wechat/wechatRepairPicture/delete",/**图片上传删除图片 */
  addRepair:"/adscm/wechat/wechatRepair/insert",/**故障申报 */
  updateRepair: "/adscm/wechat/wechatRepair/update",/**故障单处理 */
  repairList: "/adscm/wechat/wechatRepair/select",/**我的报修单 */
  repairDetail:"/adscm/wechat/wechatRepair/selectById/" ,/**报修单详情 */
  deleteRepair:"/adscm/wechat/wechatRepair/deleteById/",/**删除报修单 */
  sendRepairList:"/adscm/wechat/wechatSendRepair/select",/**我的维修单 */
  sendRepairDetail: "/adscm/wechat/wechatSendRepair/selectById/",/**维修单详情 */
  repairPersonnel:"/adscm/wechat/wechatUser/selectByRoleId",/**获取维修人员列表 */
  updateSendRepair:"/adscm/wechat/wechatSendRepair/update",/**提交维修单详情 */
  materialList:"/adscm/wechat/wechatMaterial/select",/**零件库 */
  insertMaterial:"/adscm/wechat/wechatMaterial/insert",/**新增零件库 */
  updateMaterial:"/adscm/wechat/wechatMaterial/update",/**修改零件库 */
  materialAll:"/adscm/wechat/cgMaterial/selectAll",/**佳颖所有零件 */
  materialDetail:"/adscm/wechat/wechatMaterial/selectById/",/**根据零件id查询零件详情 */
  partsList:"/adscm/wechat/wechatParts/select",/**备件库列表 */
  insertParts: "/adscm/wechat/wechatParts/insert",/**新增备件库 */
  updateParts: "/adscm/wechat/wechatParts/update",/**修改备件库 */
  partsDetail: "/adscm/wechat/wechatParts/selectById/",/**备件详情 */
  selfRepairList:"/adscm/wechat/wechatSelfRepair/select",/**我的自修单列表 */
  selfRepairDetail: "/adscm/wechat/wechatSelfRepair/selectById/",/**自修单详情 */
  updateSelfRepair: "/adscm/wechat/wechatSelfRepair/update",/**提交自修单出来详情 */
  jqbzAll:"/adscm/wechat/jqbzSettings/selectAll",/**获取备件所有类型 */
  allMaterialParts:"/adscm/wechat/wechatMaterial/selectInStock",/**获取所有备件库和零件库 */
  insertSelfRepairUse:"/adscm/wechat/wechatSelfRepairUse/insert",/**自修单新增换上的备件或零件 */
  selfRepairUseList: "/adscm/wechat/wechatSelfRepairUse/selectByPid/",/** 自修单换上的备件或零件列表*/
  deleteRepairUse: "/adscm/wechat/wechatSelfRepairUse/deleteById/",/**自修单删除换上的备件或零件 */
  uninstallMaterialList:"/adscm/wechat/wechatMaterialUninstall/selectByPid/",/**换下来的部件列表 */
  insertUninstallMaterial:"/adscm/wechat/wechatMaterialUninstall/insert",/**新增换下的部件 */
  deleteUninstallMaterial: "/adscm/wechat/wechatMaterialUninstall/deleteById/",/**移除换下的部件 */
  insertSendRepairUse: "/adscm/wechat/wechatSendRepairUse/insert",/**派修单新增换上的备件或零件 */
  sendRepairUseList: "/adscm/wechat/wechatSendRepairUse/selectByPid/",/** 派修单换上的备件或零件列表*/
  deleteSendRepairUse: "/adscm/wechat/wechatSendRepairUse/deleteById/",/**派修单删除换上的备件或零件 */
  addUpdateMaintain: "/adscm/wechat/wechatUpkeep/",/**insert-新增保养单  update-编辑保养单*/
  maintainList:"/adscm/wechat/wechatUpkeep/select" ,/**保养单列表 */
  maintainDetail:"/adscm/wechat/wechatUpkeep/selectById/",/**保养单详情 */
  insertMaintainRepairUse: '/adscm/wechat/wechatUpkeepUse/insert',/**保养单新增换上的备件或零件 */
  maintainRepairUseList: "/adscm/wechat/wechatUpkeepUse/selectByPid/",/**保养单换上的备件或零件列表 */
  deleteMaintainRepairUse: '/adscm/wechat/wechatUpkeepUse/deleteById/',/**保养单新增换上的备件或零件 */
  getSelfRepairDetail:"/adscm/wechat/wechatSelfRepair/selectByPid/" ,/**根据报修单id查询自修详情 */
  getSendRepairDetail: "/adscm/wechat/wechatSendRepair/selectByPid/",/**根据报修单id查询派修详情 */
}
module.exports={
  getOpenId(data) {
    return http({
      url: url.getOpenid,
      method: 'POST',
      header: {
        "Content-Type": "application/x-www-form-urlencoded"
      },
      data
    })
  },
  getRole(){
    return http({
      url: url.getRole,
    })
  },
  shCustomerListAll(){
    return http({
      url: url.shCustomerListAll,
      method: 'POST',
    })
  },
  getUserinfo(){
    return http({
      url: url.userInfo,
    })
  },
  addUpdateUserInfo(type,data){
    return http({
      url: url.addUpdateUserInfo+type,
      method: 'POST',
      data
    })
  },
  getMachineList(data){
    return http({
      url: url.getMachineList,
      method: 'POST',
      data
    })
  },
  getMachineByMacCode(data){
    return http({
      url: url.getMachineByMacCode,
      data
    })
  },
  getMachineListAll(){
    return http({
      url: url.getMachineListAll
    })
  },
  imageUpload(filePath){
    return httpFormData({
      url: url.imageUpload,
      method: 'POST',
      filePath: filePath
    })
  },
  deleteImage(data){
    return http({
      url: url.deleteImage,
      data
    })
  },
  addRepair(data){
    return http({
      url: url.addRepair,
      method: 'POST',
      data
    })
  },
  updateRepair(data){
    return http({
      url: url.updateRepair,
      method: 'POST',
      data
    })
  },
  repairList(data){
    return http({
      url: url.repairList,
      method: 'POST',
      data
    })
  },
  repairDetail(id){
    return http({
      url: url.repairDetail + id,
    })
  },
  deleteRepair(id){
    return http({
      url: url.deleteRepair + id,
    })
  },
  repairPersonnel(data){
    /**params  roleId： 3-自修 4-派修 */
    return http({
      url: url.repairPersonnel,
      data
    })
  },
  sendRepairList(data){
    return http({
      url: url.sendRepairList,
      method: 'POST',
      data
    })
  },
  sendRepairDetail(id){
    return http({
      url: url.sendRepairDetail+id,
    })
  },
  updateSendRepair(data){
    return http({
      url: url.updateSendRepair,
      method: 'POST',
      data
    })
  },
  materialList(data){
    return http({
      url: url.materialList,
      method: 'POST',
      data
    })
  },
  insertMaterial(data){
    return http({
      url: url.insertMaterial,
      method: 'POST',
      data
    })
  },
  materialAll(data){
    return http({
      url: url.materialAll,
      data
    })
  },
  updateMaterial(data){
    return http({
      url: url.updateMaterial,
      method: 'POST',
      data
    })
  },
  materialDetail(id){
    return http({
      url: url.materialDetail+id,
    })
  },
  partsList(data){
    return http({
      url: url.partsList,
      method: 'POST',
      data
    })
  },
  insertParts(data){
    return http({
      url: url.insertParts,
      method: 'POST',
      data
    })
  },
  updateParts(data) {
    return http({
      url: url.updateParts,
      method: 'POST',
      data
    })
  },
  partsDetail(id){
    return http({
      url: url.partsDetail+id
    })
  },
  selfRepairList(data){
    return http({
      url: url.selfRepairList,
      method: 'POST',
      data
    })
  }, 
  selfRepairDetail(id){
    return http({
      url: url.selfRepairDetail+id
    })
  },
  updateSelfRepair(data){
    return http({
      url: url.updateSelfRepair,
      method: 'POST',
      data
    })
  },
  jqbzAll(){
    return http({
      url: url.jqbzAll
    })
  },
  allMaterialParts(data){
    return http({
      url: url.allMaterialParts,
      data
    })
  },
  insertSelfRepairUse(data){
    return http({
      url: url.insertSelfRepairUse,
      method: 'POST',
      data
    })
  },
  selfRepairUseList(pid){
    return http({
      url: url.selfRepairUseList + pid
    })
  },
  deleteRepairUse(id){
    return http({
      url: url.deleteRepairUse + id
    })
  },
  uninstallMaterialList(pid,type){
    /**pid-维修单id,type- 1是自修单 2是派修单 3是保养单*/
    return http({
      url: url.uninstallMaterialList + `${pid}/${type}`
    })
  },
  insertUninstallMaterial(data){
    return http({
      url: url.insertUninstallMaterial,
      method: 'POST',
      data
    })
  },
  deleteUninstallMaterial(id){
    return http({
      url: url.deleteUninstallMaterial + id
    })
  },
  insertSendRepairUse(data){
    return http({
      url: url.insertSendRepairUse,
      method: 'POST',
      data
    })
  },
  sendRepairUseList(id){
    return http({
      url: url.sendRepairUseList + id
    })
  },
  deleteSendRepairUse(id){
    return http({
      url: url.deleteSendRepairUse + id
    })
  },
  addUpdateMaintain(type,data){
    return http({
      url: url.addUpdateMaintain + type,
      method: 'POST',
      data
    })
  },
  maintainList(data){
    return http({
      url: url.maintainList,
      method: 'POST',
      data
    })
  },
  maintainDetail(id){
    return http({
      url: url.maintainDetail+id
    })
  },
  insertMaintainRepairUse(data){
    return http({
      url: url.insertMaintainRepairUse,
      method: 'POST',
      data
    })
  },
  maintainRepairUseList(id){
    return http({
      url: url.maintainRepairUseList + id
    })
  },
  deleteMaintainRepairUse(id){
    return http({
      url: url.deleteMaintainRepairUse + id
    })
  },
  getSelfRepairDetail(id){
    return http({
      url: url.getSelfRepairDetail + id
    })
  },
  getSendRepairDetail(id){
    return http({
      url: url.getSendRepairDetail + id
    })
  }

}